using System;
using System.Collections.Generic;
using System.Globalization;
using ns20;

namespace Newtonsoft.Json.Linq
{
	public class JConstructor : JContainer
	{
		private string string_0;

		private readonly List<JToken> list_0 = new List<JToken>();

		protected override IList<JToken> ChildrenTokens => list_0;

		public string Name
		{
			get
			{
				return string_0;
			}
			set
			{
				string_0 = value;
			}
		}

		public override JTokenType Type => JTokenType.Constructor;

		public override JToken this[object key]
		{
			get
			{
				Class204.smethod_2(key, "o");
				if (!(key is int))
				{
					throw new ArgumentException("Accessed JConstructor values with invalid key value: {0}. Argument position index expected.".smethod_0(CultureInfo.InvariantCulture, Class194.smethod_2(key)));
				}
				return Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_200D_200D_206C_202C_206E_200C_206B_200B_200E_200D_206F_200F_200F_206F_206A_202B_200E_206D_206E_206E_206B_202A_206B_200B_200D_206B_202A_202B_206D_202C_206B_202B_206F_200F_200C_202C_200B_202C_206E_202E((int)key);
			}
			set
			{
				Class204.smethod_2(key, "o");
				if (!(key is int))
				{
					throw new ArgumentException("Set JConstructor values with invalid key value: {0}. Argument position index expected.".smethod_0(CultureInfo.InvariantCulture, Class194.smethod_2(key)));
				}
				Newtonsoft_002EJson_002ELinq_002EJContainer_002E_206D_206D_202C_206A_206B_206A_200C_206B_202A_202C_206E_200D_206C_202E_206A_206F_206B_202A_200F_206E_206A_202E_200B_206C_200F_200D_202B_202D_200C_206B_206E_206D_200E_206B_200D_206C_202C_206A_202B_206E_202E((int)key, value);
			}
		}

		public JConstructor()
		{
		}

		public JConstructor(JConstructor other)
			: base(other)
		{
			string_0 = other.Name;
		}

		public JConstructor(string name, params object[] content)
			: this(name, (object)content)
		{
		}

		public JConstructor(string name, object content)
			: this(name)
		{
			Add(content);
		}

		public JConstructor(string name)
		{
			Class204.smethod_0(name, "name");
			string_0 = name;
		}

		internal override bool Newtonsoft_002EJson_002ELinq_002EJToken_002E_206F_200C_206F_206F_206B_200E_206C_206B_200C_200D_202E_200E_200E_200D_202C_200D_200C_206B_200F_202D_202E_200F_200C_202D_206B_200D_206B_206E_202E_206E_202B_206D_206E_206F_202C_202E_200D_200C_200D_200F_202E(JToken jtoken_2)
		{
			JConstructor jConstructor = jtoken_2 as JConstructor;
			if (jConstructor != null && string_0 == jConstructor.Name)
			{
				return method_3(jConstructor);
			}
			return false;
		}

		internal override JToken Newtonsoft_002EJson_002ELinq_002EJToken_002E_206F_206A_202E_200B_200D_206A_200C_200E_206A_202D_200E_206E_206F_200B_206C_200F_200C_200C_202A_206B_200C_202D_200B_202B_202A_202D_202B_206A_206F_206F_202D_200C_206F_202E_206B_200D_206C_202D_202E_200E_202E()
		{
			return new JConstructor(this);
		}

		public override void WriteTo(JsonWriter writer, params JsonConverter[] converters)
		{
			writer.WriteStartConstructor(string_0);
			foreach (JToken item in Children())
			{
				item.WriteTo(writer, converters);
			}
			writer.WriteEndConstructor();
		}

		internal override int Newtonsoft_002EJson_002ELinq_002EJToken_002E_200C_202A_206D_200B_206C_206F_202A_200F_200E_206E_200D_202D_200B_200D_206E_202D_206E_200D_202E_206B_206F_206F_202B_206D_206D_202E_206C_200F_202D_202A_206B_206B_200D_202A_200C_202D_200F_202A_206F_200F_202E()
		{
			return string_0.GetHashCode() ^ method_12();
		}

		public new static JConstructor Load(JsonReader reader)
		{
			if (reader.JsonToken_0 == JsonToken.None && !reader.Read())
			{
				throw JsonReaderException.smethod_1(reader, "Error reading JConstructor from JsonReader.");
			}
			while (reader.JsonToken_0 == JsonToken.Comment)
			{
				reader.Read();
			}
			if (reader.JsonToken_0 != JsonToken.StartConstructor)
			{
				throw JsonReaderException.smethod_1(reader, "Error reading JConstructor from JsonReader. Current JsonReader item is not a constructor: {0}".smethod_0(CultureInfo.InvariantCulture, reader.JsonToken_0));
			}
			JConstructor jConstructor = new JConstructor((string)reader.Object_0);
			jConstructor.method_0(reader as IJsonLineInfo);
			jConstructor.method_10(reader);
			return jConstructor;
		}
	}
}
